package com.ruoyi.jkcrData.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.jkcrData.domain.plat.DataJkcrQyl;
import com.ruoyi.jkcrData.service.IDataJkcrQylService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 架空乘人牵引力测试数据Controller
 * 
 * @author ruoyi
 * @date 2024-02-19
 */
@RestController
@RequestMapping("/jkcrData/qyl")
@Api(value="架空乘人-牵引力测试",tags = "架空乘人-牵引力接口")
public class DataJkcrQylController extends BaseController
{
    @Autowired
    private IDataJkcrQylService dataJkcrQylService;

    /**
     * 查询架空乘人牵引力测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:list')")
    @GetMapping("/list")
    public TableDataInfo list(DataJkcrQyl dataJkcrQyl)
    {
        startPage();
        List<DataJkcrQyl> list = dataJkcrQylService.selectDataJkcrQylList(dataJkcrQyl);
        return getDataTable(list);
    }

    /**
     * 导出架空乘人牵引力测试数据列表
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:export')")
    @Log(title = "架空乘人牵引力测试数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DataJkcrQyl dataJkcrQyl)
    {
        List<DataJkcrQyl> list = dataJkcrQylService.selectDataJkcrQylList(dataJkcrQyl);
        ExcelUtil<DataJkcrQyl> util = new ExcelUtil<DataJkcrQyl>(DataJkcrQyl.class);
        util.exportExcel(response, list, "架空乘人牵引力测试数据数据");
    }

    /**
     * 获取架空乘人牵引力测试数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:query')")
    @GetMapping(value = "/{qylId}")
    public AjaxResult getInfo(@PathVariable("qylId") Long qylId)
    {
        return success(dataJkcrQylService.selectDataJkcrQylByQylId(qylId));
    }

    /**
     * 新增架空乘人牵引力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:add')")
    @Log(title = "架空乘人牵引力测试数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DataJkcrQyl dataJkcrQyl)
    {
        return toAjax(dataJkcrQylService.insertDataJkcrQyl(dataJkcrQyl));
    }

    /**
     * 修改架空乘人牵引力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:edit')")
    @Log(title = "架空乘人牵引力测试数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DataJkcrQyl dataJkcrQyl)
    {
        return toAjax(dataJkcrQylService.updateDataJkcrQyl(dataJkcrQyl));
    }

    /**
     * 修改架空乘人牵引力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:edit')")
    @Log(title = "修改架空乘人牵引力测试数据", businessType = BusinessType.UPDATE)
    @PutMapping("/delQyl/{qylId}")
    @ApiOperation(value="修改架空乘人牵引力测试数据")
    public AjaxResult delQyl(@PathVariable Long qylId)
    {
        return toAjax(dataJkcrQylService.updateDataJkcrQylByQylId(qylId));
    }

    /**
     * 删除架空乘人牵引力测试数据
     */
    @PreAuthorize("@ss.hasPermi('jkcrData:qyl:remove')")
    @Log(title = "架空乘人牵引力测试数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{qylIds}")
    public AjaxResult remove(@PathVariable Long[] qylIds)
    {
        return toAjax(dataJkcrQylService.deleteDataJkcrQylByQylIds(qylIds));
    }
}
